home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
jovept2.arc
/
TTOUT.C
< prev
next >
Wrap
Text File
|
1985-05-30
|
3KB
|
148 lines
/* ttout.c */
/* JOVE/MSDOS. K. Mitchum 1/85 */
/* Modifications for personal use only. */
/* original code J. Payne LSRHS 5/83 */
/* Ken Mitchum */
/* University of Pittsburgh */
/* Decision Systems Laboratory */
/*
Jonathan Payne at Lincoln-Sudbury Regional High School 5-25-83
jove_ttout.c
Deals with output to the terminal, setting up the amount of characters
to be buffered depending on the output baud rate. Why it's in a
separate file I don't know ... */
#include "jove.h"
#include "term.h"
extern int CheckTime; /* screen.c */
#ifdef UNIX
IOBUF termout;
#endif
outc(c)
register int c;
{
outchar(c);
}
/* Put a string with padding */
putpad(str, lines)
char *str;
{
#ifdef TERMCAP
tputs(str, lines, outc);
#else
do {
outchar(*str);
}while (*(++str));
#endif
}
/*--------------------------o.s. dependent------------------------*/
#ifdef UNIX
/* Flush the output, and check for more characters. If there are
* some, then return to main, to process them, aborting redisplay.
*/
flushout(x, p)
IOBUF *p;
{
register int n;
CheckTime = 1;
if ((n = p->io_ptr - p->io_base) > 0) {
ignore(write(p->io_file, p->io_base, n));
if (p == &termout) {
CheckTime = BufSize;
p->io_cnt = BufSize;
} else
p->io_cnt = BUFSIZ;
p->io_ptr = p->io_base;
}
if (x >= 0)
Putc(x, p);
}
/* Determinte the number of characters to buffer at each
* baud rate. The lower the number, the quicker the
* response when new input arrives. Of course the lower
* the number, the more prone the program is to stop in
* output. Decide what matters most to you.
* This sets the int BufSize to the right number or chars,
* allocates the buffer, and initiaizes `termout'.
*/
settout()
{
static int speeds[] = {
1, /* 0 */
1, /* 50 */
1, /* 75 */
1, /* 110 */
1, /* 134 */
1, /* 150 */
1, /* 200 */
1, /* 300 */
1, /* 600 */
5, /* 1200 */
15, /* 1800 */
30, /* 2400 */
60, /* 4800 */
120, /* 9600 */
0, 100, /* EXTA */
0, 120 /* EXT */
};
/* termout.io_cnt = BufSize = CheckTime = speeds[ospeed] * max(LI / 24, 1);
termout.io_base = termout.io_ptr = emalloc(BufSize);
termout.io_flag = 0;
termout.io_file = 1;
termout.io_bufsiz = BufSize;
*/
termout.io_cnt = BufSize = CheckTime = 4096;
termout.io_base = termout.io_ptr = emalloc(BufSize);
termout.io_flag = 0;
termout.io_file = 1; /* Standard output */
termout.io_bufsiz = BufSize;
}
#else
/* clone */
flushout()
{
}
settout()
{
}
#endif
/* end */